#ifndef EXPAND_H_
#define EXPAND_H_
#include "Multitree.h"

/*Functions that expand polynomials
 * When we want to expand childs of MULTIPLY node, we separate
 * them to two groups. Those that are iverted and those that are not.
 * (Then we expand both groups in the same way and then put them as childs
 * to new MULTIPLY node. For example a/b*c/d is separated to (a,c) and (b,d)
 * then a*c and b*d are both expanded and put back as (a*c)/(b*d).
 * In (a+b)*(c+d)*(e+f) we first expand everything except first factor
 * and then multiply first factor with the rest. So first we get
 * (a+b)*(c*e + c*f + d*e + d*f) and now to each "part" of the second factor
 * we put a and b -> (ace+acf+ade+adf+bce+bcf+bde+bdf).
 */

namespace SymCe{
	
	//Takes from list those childs that have same inverted flag
	ListOfChilds * separate_inverted(ListOfChilds * childs, bool inverted);
	//Expands *, leaves everything else intact.

	Multitree * expand_multiply(Multitree * tree);
	//Takes every child of first argument and adds it to every child of the second argument.
	ListOfChilds * add_to_expanded(ListOfChilds * to_be_added, ListOfChilds * where);

}




#endif /*EXPAND_H_*/
